import request from '@/axios'
import { SysTransferCenterDetailVo, SysTransferCenterEditQo, SysTransferCenterListVo, SysTransferCenterSearchQo } from './types'
import { BaseDeleteQo } from '@/base/api/BaseQo'
import { KeyLabelValueVo } from '@/base/api/KeyLabelValueVo'

export const sysTransferCenterPageApi = (data: SysTransferCenterSearchQo): Promise<IResponse<Array<SysTransferCenterListVo>>> => {
  return request.post({ url: '/sysTransferCenter/page.adw', data })
}

export const sysTransferCenterMyExportPageApi = (data: SysTransferCenterSearchQo): Promise<IResponse<Array<SysTransferCenterListVo>>> => {
  return request.post({ url: '/sysTransferCenter/myExportPage.adw', data })
}

export const sysTransferCenterMyImportPageApi = (data: SysTransferCenterSearchQo): Promise<IResponse<Array<SysTransferCenterListVo>>> => {
  return request.post({ url: '/sysTransferCenter/myImportPage.adw', data })
}

export const sysTransferCenterDetailApi = (id: number): Promise<IResponse<SysTransferCenterDetailVo>> => {
  const data = { id }
  return request.post({
    url: '/sysTransferCenter/detail.adw',
    data
  })
}

export const sysTransferCenterAddApi = (data: SysTransferCenterEditQo): Promise<IResponse<number>> => {
  return request.post({ url: '/sysTransferCenter/add.adw', data })
}

export const sysTransferCenterUpdateApi = (data: SysTransferCenterEditQo): Promise<IResponse<void>> => {
  return request.post({ url: '/sysTransferCenter/update.adw', data })
}

export const sysTransferCenterDeleteApi = (data: BaseDeleteQo): Promise<IResponse<void>> => {
  return request.post({ url: '/sysTransferCenter/delete.adw', data })
}

export const sysTransferCenterPackageDownloadApi = (id: number): Promise<IResponse<void>> => {
  return request.downloadGet({
    url: `/sysTransferCenter/packageDownload.adw?id=${id}`,
    responseType: 'blob'
  })
}

// [[ OnflowGenerator Range (- selectFunctions -) Start ]]
export const selectSysTransferCenterNameListApi = (
  data: SysTransferCenterSearchQo
): Promise<IResponse<Array<KeyLabelValueVo>>> => {
  return request.post({ url: '/sysTransferCenter/selectNameList.adw', data })
}
// [[ OnflowGenerator Range (- selectFunctions -) End ]]
